package com.sff.system {
	
	import com.sff.core.sff_internal;
	
	import flash.utils.Dictionary;	
	
	public final class LayersProviderClass {
		
		private static var instance : LayersProviderClass;
		private var dicLayer 		: Dictionary;
		
		public function LayersProviderClass( ) {
			if( instance != null ) {
				throw new Error( "singleton class" );
			}
			
			dicLayer = new Dictionary();
		}
		
		public static function start( ) : LayersProviderClass {
			if (instance == null) {
				instance = new LayersProviderClass();
			}
			return instance;
		}
		
		sff_internal function hasLayer( id : String ) : Boolean {
			return ( dicLayer[ id ] != undefined );
		}
		
		sff_internal function getLayer( id : String ) : LayerSystem {
			return sff_internal::hasLayer( id ) ? dicLayer[ id ]: null;
		}
		
		sff_internal function addLayer(id:String, layer : LayerSystem) : void {
			dicLayer[id] = layer;
		}
		
		sff_internal function removeLayer( id : String ) : void {
			if( dicLayer[ id ] == undefined ) {
				return;
			}
			delete dicLayer[ id ];
		}		
	}
}